var Rotation = 0.0;

main();

function main() {
    const canvas = document.querySelector('#canvas3');
    const gl = canvas.getContext('webgl');

    if (!gl) {
        alert('加载失败，请更换浏览器');
        return;
    }

    const shaderProgramInfo = createNormalShaderProgramInfo(gl);

    const ball_buffer = Ball_bufferInit(gl, 1, 5);

    var then = 0;

    function render(now) {
        var packedInfos = [];

        //创建球体
        ball_modelmatrixInfo = {
            translateAttri: [0.0, 0.0, -6.0],
            rotateSpeed: [0.7, 0.8, 1.0],
            transAfterRot: [0.0, 0.3, 0.0],
        };
        const ball_matrix = createModelViewMatrix(ball_modelmatrixInfo);

        const ball_packedInfo = packInfo(ball_buffer, ball_matrix, shaderProgramInfo);
        packedInfos.push(ball_packedInfo);
        //////////

        now *= 0.001;
        const deltaTime = now - then;
        then = now;

        drawScene(gl, packedInfos, deltaTime);

        requestAnimationFrame(render);
    }

    requestAnimationFrame(render);
}